package com.itheima.mapper;

import com.itheima.entity.Emp;
import com.itheima.entity.EmpExpr;
import com.itheima.entity.EmpQueryParam;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface EmpMapper {

///*
//分页查询
// */
//    @Select("select e.*,d.name deptName from emp e left join dept d on e.dept_id = d.id limit #{page},#{pageSize}")
//    public List<Emp> getRows(Integer page,Integer pageSize);
///*
//查询总记录数
// */
//    @Select("select count(*) from emp")
//    public Long getTotal();

    /*
    列表查询
     */
//    @Select("select e.*,d.name deptName from emp e left join dept d on e.dept_id = d.id ")
    List<Emp> list(EmpQueryParam param);

    /*
    新新增员工
     */
   /* @Options(useGeneratedKeys=true,keyProperty="id")//获取主键的值并赋给id属性
    @Insert("insert into emp values (null,#{username},#{password},#{name},#{gender},#{phone}" +
            ",#{job},#{salary},#{image},#{entryDate},#{deptId},#{createTime},#{updateTime})")*/
    void insert(Emp emp);


    /*
    删除员工
     */
    void delete(List<Integer> ids);

    /*
    查询员工信息
     */
    @Select("select * from emp where id=#{id}")
    Emp getById(Integer id);
    /**
     * 更新员工信息
     */
    void update(Emp emp);

    /**
     * 查询所有员工
     * @return
     */
    @Select("select * from emp")
    List<Emp> listEmp();
}
